/**
 * 激怒
 */

import { Buff } from "../class/Effect";
import { Method } from "../class/Method";
import { Role } from "../class/Role";

export class Infuriate extends Method {
    static methodName = "激怒"
    public CD: number = 50E3;
    public describe: string = "激怒自己，增加 100% 物理/法术攻击 和 100% 物理/法术防御，并在30秒内逐渐衰减";
    public invoke() {
        this, this.masterRole.addEffectByClass(class extends Buff {
            public sumTime: number = 30E3;
            public eachTime: number = 1E3;
            public invoke(): void {
                /** 增幅比例 */
                const proportion = (this.sumAmount - this.amount) / this.sumAmount;// 

                this.masterRole.getPhysicsAttack = function (this: Role) {
                    return this.PA + Math.floor(this.PA * proportion);
                }
                this.masterRole.getMagicAttack = function (this: Role) {
                    return this.MA + Math.floor(this.MA * proportion);
                }
                this.masterRole.getPhySicsDefend = function (this: Role) {
                    return this.PD + Math.floor(this.PD * proportion);
                }
                this.masterRole.getMaginDefend = function (this: Role) {
                    return this.MD + Math.floor(this.MD * proportion);
                }
            }

        })

    }
}